

//
//  HotDecatilViewController.m
//  庐山通
//
//  Created by zcj on 15-11-4.
//  Copyright (c) 2015年 郑朝军. All rights reserved.
//

#import "HotDecatilViewController.h"
#import "HotModel.h"
#import "MyDecatilView.h"
#import "DecatilTableViewCell.h"
#import "hotDecalFrame.h"
#import <UIKit/UIKit.h>
#import "Grouble.h"

@interface HotDecatilViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,weak)UITableView * tableView;


@property (nonatomic,strong)hotDecalFrame * hotDecalFrame;
@end

@implementation HotDecatilViewController

- (hotDecalFrame *)hotDecalFrame
{
    if (_hotDecalFrame == nil) {
        _hotDecalFrame = [[hotDecalFrame alloc]init];
    }
    return _hotDecalFrame;
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self setNavBar];
    [self setTableView];
    [self setHeaderFrame];
    [self addHeaderView];
    //ZCJLog(@"%@",self.hotModel);
    // Do any additional setup after loading the view.
}
- (void)setHeaderFrame
{
    self.hotDecalFrame.hotModel = self.hotModel;
}
- (void)addHeaderView
{
    CGFloat headerX = 0;
    CGFloat headerY = 0;
    CGFloat headerW = ScreenWidth;
    CGFloat headerH = ScreenHeight * 0.8;
    
    MyDecatilView * headerView = [[MyDecatilView alloc]init];
    headerView.frame = CGRectMake(headerX, headerY, headerW, headerH);
    headerView.hotModel = self.hotDecalFrame;
    headerView.backgroundColor = [UIColor redColor];
    self.tableView.tableHeaderView = headerView;
}
- (void)setTableView
{
    UITableView * myTableView = [[UITableView alloc]initWithFrame:self.view.bounds];
    myTableView.separatorStyle = NO;
    myTableView.backgroundColor = [UIColor whiteColor];
//    myTableVie
    myTableView.delegate = self;
    myTableView.dataSource = self;
    [self.view addSubview:myTableView];
    self.tableView = myTableView;
}
- (void)setNavBar
{
    self.navigationController.view.backgroundColor = [UIColor whiteColor];
    
    UIBarButtonItem * louzhu = [UIBarButtonItem itemWithIcon:@"navigationbar_pop" highIcon:@"navigationbar_pop_highlighted" target:self action:@selector(pop)];
    UIBarButtonItem * camera = [UIBarButtonItem itemWithIcon:@"navigationbar_pop" highIcon:@"navigationbar_pop_highlighted" target:self action:@selector(pop)];
    UIBarButtonItem * more = [UIBarButtonItem itemWithIcon:@"navigationbar_pop" highIcon:@"navigationbar_pop_highlighted" target:self action:@selector(pop)];
    
    self.navigationItem.rightBarButtonItems = @[louzhu,camera,more];
    
    self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithIcon:@"navigationbar_pop" highIcon:@"navigationbar_pop_highlighted" target:self action:@selector(leftClick)];
    
    self.navigationItem.title = @"细节";
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 10;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    DecatilTableViewCell * cell = [DecatilTableViewCell DecatilTableViewCell:tableView];
    return cell;
}
- (void)pop
{
    ZCJLog(@"为实现");
}
- (void)leftClick
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
